package org.budo.redis.jdbc.driver.statement.mysql;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;

import org.budo.jdbc.driver.AbstractBudoJdbcPreparedStatement;
import org.budo.jdbc.driver.resultset.impl.MapArrayResultSet;
import org.budo.redis.jdbc.driver.statement.AbstractRedisStatement;
import org.budo.support.lang.util.MapUtil;

/**
 * SHOW table status
 * 
 * @author lmw
 * @see org.budo.redis.jdbc.driver.statement.mysql.SELECT_HELP
 */
public class SHOW_TABLE_STATUS extends AbstractRedisStatement {
    @Override
    public void execute(PreparedStatement preparedStatement) throws SQLException{
        String[] columnNames = new String[] { "Name", "Engine", "Comment" };
        Map[] mapArray = new Map[] { //
                MapUtil.stringMap("Name", SELECT_HELP.TABLE_NAME, "Engine", "InnoDB", "Comment", "") //
        };

        ResultSet resultSet = new MapArrayResultSet(columnNames, mapArray);
        ((AbstractBudoJdbcPreparedStatement) preparedStatement).setResultSet(resultSet);
    }
}